const express = require('express');
const router = express.Router();
const {asyncHandler} = require('../utils/sendResult');
const {
    addEnroll, getEnroll, editEnroll,
} = require("../services/enrollServices");

// 提交报名信息
router.post("/", asyncHandler((req, res, next) => {
    req.body.user = req.userInfo._id
    return addEnroll(req.body)
}))

// 分页获取报名列表
router.get("/",asyncHandler((req, res, next) => {
    return getEnroll(req.query)
}))

// 修改报名信息
router.post("/:id",asyncHandler((req, res, next) => {
    return editEnroll(req.params.id,req.body)
}))

module.exports = router;
